<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>聚类分析结果</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .container {
            max-width: 1200px;
            margin: 20px auto;
        }
        .card {
            margin-bottom: 20px;
        }
        .image-container {
            max-width: 100%;
            overflow-x: auto;  /* 长图滚动显示 */
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="text-center mb-4">聚类分析结果</h1>

        <!-- 聚类结果分布 -->
        <div class="card shadow">
            <div class="card-header bg-primary text-white">
                <h3>K-Means聚类结果（k=9）</h3>
            </div>
            <div class="card-body">
                <div class="image-container">
                    <img src="data:image/png;base64,{{ clustering_img }}"
                         alt="Clustering Results"
                         class="img-fluid">
                </div>
            </div>
        </div>

        <!-- 最佳聚类数分析 -->
        <div class="card shadow">
            <div class="card-header bg-info text-white">
                <h3>最佳聚类数确定</h3>
            </div>
            <div class="card-body">
                <div class="image-container">
                    <img src="data:image/png;base64,{{ optimal_clusters_img }}"
                         alt="Optimal Clusters"
                         class="img-fluid">
                </div>
            </div>
        </div>

        <!-- 聚类质量报告 -->
        <div class="card shadow">
            <div class="card-header bg-secondary text-white">
                <h3>聚类质量评估报告</h3>
            </div>
            <div class="card-body">
                <pre>{{ quality_report }}</pre>  <!-- 保留文本格式 -->
            </div>
        </div>

        <!-- 返回按钮 -->
<!--        <div class="text-center mt-4">-->
<!--            <a href="{{ url_for('index') }}" class="btn btn-secondary">返回首页</a>-->
<!--        </div>-->
    </div>
</body>
</html>